/*
 * @Author: zxc
 * @Date: 2020-08-13 13:56:56
 * @LastEditTime: 2020-09-08 10:18:39
 * @LastEditors: zxc
 * @Description:
 */
import React from "react";
import Loadable from "react-loadable";
import Auth from "./Auth";
import loadings from "./loadings";
import RouteWithSubRouters from "./RouteWithSubRouters";
import BlogLayout from "../layout";
import blog from "./config/blog";
import person from "./config/person";

import {
  DiffOutlined,
  BoldOutlined,
  DashboardOutlined,
} from "@ant-design/icons";

export default [
  {
    //顶级路由（鉴权）是一个单纯的逻辑组件，没有icon、name这些和路由导航相关的文件
    // 路由鉴权 不管什么情况，都是需要走这个组件的 都是必须先过这个组件的关卡
    component: Auth,
    routes: [
      {
        // 1级级路由
        component: Loadable({
          loader: () => import("../pages/login"),
          ...loadings,
        }),
        path: "/login",
      },
      {
        // 404
        path: '/404',
        component: Loadable({
          loader: () => import('../components/not-found/NotFound'),
          ...loadings,
        }),
      },
      {
        path: "/",
        component: BlogLayout,
        routes: [
          //这里应该还有一个404
          {
            //1级路由
            component: Loadable({
              loader:() => import("../pages/dashboard"),
              ...loadings
            }),
            icon: <DashboardOutlined />,
            name: "工作台",
            path: "/dashboard",
          },
          {
            //1级路由
            component: RouteWithSubRouters,
            icon: <DiffOutlined />,
            name: "博文管理",
            path: "/article-manage",
            routes: blog,
          },
          {
            //1级路由
            component: RouteWithSubRouters,
            icon: <BoldOutlined />,
            name: "个人中心",
            path: "/person",
            routes: person,
          },
        ],
      },
    ],
  },
];
